/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-08-14     RiceChen     first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

#include "hal_rcc.h"
#include "hal_gpio.h"

int main(void)
{
    GPIO_Init_Type gpio_init;

    RCC_EnableAHB1Periphs(RCC_AHB1_PERIPH_GPIOI, true);
    RCC_ResetAHB1Periphs(RCC_AHB1_PERIPH_GPIOI);

    gpio_init.Pins  = GPIO_PIN_0;
    gpio_init.PinMode  = GPIO_PinMode_Out_PushPull;
    gpio_init.Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOI, &gpio_init);
    /* set LED_GREEN pin mode to output */
    //rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);

    for(;;)
    {
        GPIO_WriteBit(GPIOI, GPIO_PIN_0, 1u);
        rt_thread_mdelay(500);
        GPIO_WriteBit(GPIOI, GPIO_PIN_0, 0u);
        rt_thread_mdelay(500);
    }

    return RT_EOK;
}
